package com.teach;

import java.util.Scanner;

import com.teach.demo03.Machine01;

/**
 * - 控制台版本的自动售货机 模拟
 * @author J.L.Zhou
 */
public class MachineConsole01 {

	private static Scanner sc;
	private static Machine machine = new Machine01();

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		machine.add(new Product(TypeName.Coffee, "猫屎", 20d));
		machine.add(new Product(TypeName.Coffee, "蓝山", 15d));
		machine.add(new Product(TypeName.Coffee, "蓝山", 15d));
		// add();
		mainMenu();
	}

	/**
	 * 主菜单操作
	 */
	public static void mainMenu() {
		System.out.println("------------主菜单-----------");
		System.out.println(" 0.客户菜单");
		System.out.println(" 1.管理菜单");
		System.out.println("---------------------------");
		int input = sc.nextInt();
		if (input == 0) {
			customerMenu();
		} else if (input == 1) {
			adminMenu();
		} else {
			System.out.println("输入错误");
			mainMenu();
		}
	}

	/**
	 * 顾客菜单
	 */
	public static void customerMenu() {
		System.out.println("\n\n------------顾客菜单-----------");
		System.out.println(" 0.返回主菜单");
		System.out.println(" 1.显示商品信息");
		System.out.println(" 2.投币");
		System.out.println(" 3.查看余额");
		System.out.println(" 4.找零");
		System.out.println(" 5.购买");
		System.out.println("----------------------------");
		int input = sc.nextInt();
		switch (input) {
		case 1:
			printInfo();
			break;
		case 2:
			
			break;
		case 3:
			
			break;
		case 4:
			
			break;
		case 5:
			buy();
			break;
		default:
			mainMenu();
			return;
		}
		customerMenu();
	}

	/**
	 * 管理菜单
	 */
	public static void adminMenu() {
		System.out.println("\n\n------------管理菜单-----------");
		System.out.println(" 0.返回主菜单");
		System.out.println(" 1.显示商品信息");
		System.out.println(" 2.添加商品");
		System.out.println(" 3.修改价格");
		System.out.println("----------------------------");
		int input = sc.nextInt();
		switch (input) {
		case 1:
			printInfo();
			break;
		case 2:
			add();
			break;
		case 3:
			modifyPrice();
			break;

		default:
			mainMenu();
			return;
		}
		adminMenu();
	}

	/**
	 * 打印商品信息
	 */
	public static void printInfo() {

	}

	/**
	 * 添加商品
	 */
	public static void add() {
		
	}

	

	/**
	 * 购买商品
	 */
	public static void buy() {
		
	}

	/**
	 * 修改价格
	 */
	public static void modifyPrice() {
		
	}

}
